<?php
session_start();
$arr = json_decode($_SESSION['brr'],true);
$u = $arr['u'];
$qd = $arr['qd'];
$it = $_POST['it'];
$hbs = $arr['zdl_hbs'];
$buzhi = $arr['gear'];
if($hbs>350){
    $ryc = 1;
} else {
    $ryc =0;
}
function KHBT ($fd,$b,$ryc,$buzhi,$it) {
    if ($fd<0.5) {
        $fd = '0.4';
    }elseif ($fd<0.7) {
        $fd = '0.6';
    }elseif ($fd<0.9){
        $fd = '0.8';
    }else{
        $fd = '1';
    }
    if($b<60){
        $b = 40;
    }elseif ($b<100){
        $b = 80;
    }elseif ($b<140){
        $b = 120;
    }elseif ($b<180){
        $b = 160;
    }else{
        $b = 200;
    }
$ruanchi = [
        1 =>[
            6=>['0.4'=>[40=>1.145,80=>1.151,120=>1.157,160=>1.163,200=>1.169,],'0.6'=>[40=>1.181,80=>1.187,120=>1.193,160=>1.199,200=>1.205,], '0.8'=>[40=>1.231, 80=>1.237, 120=>1.243, 160=>1.249, 200=>1.255,], '1'=>[40=>1.296, 80=>1.302, 120=>1.308, 160=>1.314, 200=>1.320,]],
            7=>['0.4'=>[40=>1.158, 80=>1.167, 120=>1.176, 160=>1.186, 200=>1.195,], '0.6'=>[40=>1.194, 80=>1.203, 120=>1.212, 160=>1.222, 200=>1.231,], '0.8'=>[40=>1.244, 80=>1.254, 120=>1.263, 160=>1.272, 200=>1.281,], '1'=>[40=>1.309, 80=>1.318, 120=>1.328, 160=>1.337, 200=>1.346,]],
            8=>['0.4'=>[40=>1.191, 80=>1.204, 120=>1.216, 160=>1.228, 200=>1.241,], '0.6'=>[40=>1.227, 80=>1.240, 120=>1.252, 160=>1.264, 200=>1.277,], '0.8'=>[40=>1.278, 80=>1.290, 120=>1.302, 160=>1.313, 200=>1.327,], '1'=>[40=>1.342, 80=>1.355, 120=>1.367, 160=>1.380, 200=>1.392,],]
        ],
        2 =>[
            6=>[
                '0.4'=>[40=>1.148, 80=>1.154, 120=>1.160, 160=>1.168, 200=>1.172,],
                '0.6'=>[40=>1.195, 80=>1.201, 120=>1.207, 160=>1.213, 200=>1.219,],
                '0.8'=>[40=>1.275, 80=>1.281, 120=>1.287, 160=>1.293, 200=>1.299,],
                '1'=>[40=>1.404, 80=>1.410, 120=>1.416, 160=>1.422, 200=>1.428,]
            ],
            7=>[
                '0.4'=>[40=>1.161, 80=>1.170, 120=>1.179, 160=>1.188, 200=>1.198,],
                '0.6'=>[40=>1.208, 80=>1.217, 120=>1.226, 160=>1.236, 200=>1.245,],
                '0.8'=>[40=>1.289, 80=>1.298, 120=>1.307, 160=>1.316, 200=>1.325,],
                '1'=>[40=>1.417, 80=>1.426, 120=>1.436, 160=>1.445, 200=>1.454,]
            ],
            8=>[
                '0.4'=>[40=>1.194, 80=>1.206, 120=>1.219, 160=>1.231, 200=>1.244,],
                '0.6'=>[40=>1.241, 80=>1.254, 120=>1.266, 160=>1.278, 200=>1.291,],
                '0.8'=>[40=>1.322, 80=>1.334, 120=>1.347, 160=>1.359, 200=>1.371,],
                '1'=>[40=>1.450, 80=>1.463, 120=>1.475, 160=>1.488, 200=>1.500,],
            ]
        ],
        3 =>[
            6=>[
                '0.4'=>[40=>1.176, 80=>1.182, 120=>1.188, 160=>1.194, 200=>1.200,],
                '0.6'=>[40=>1.337, 80=>1.343, 120=>1.349, 160=>1.355, 200=>1.361,],
                '0.8'=>[40=>1.725, 80=>1.731, 120=>1.737, 160=>1.743, 200=>1.749,],
                '1'=>[40=>2.502, 80=>2.508, 120=>2.514, 160=>2.520, 200=>2.526,]

            ],
            7=>[
                '0.4'=>[40=>1.189, 80=>1.198, 120=>1.207, 160=>1.216, 200=>1.226,],
                '0.6'=>[40=>1.350, 80=>1.359, 120=>1.369, 160=>1.378, 200=>1.387,],
                '0.8'=>[40=>1.738, 80=>1.748, 120=>1.757, 160=>1.766, 200=>1.775,],
                '1'=>[40=>2.515, 80=>2.524, 120=>2.534, 160=>2.543, 200=>2.552,]
            ],
            8=>[
                '0.4'=>[40=>1.222, 80=>1.234, 120=>1.247, 160=>1.259, 200=>1.272,],
                '0.6'=>[40=>1.383, 80=>1.396, 120=>1.408, 160=>1.421, 200=>1.433,],
                '0.8'=>[40=>1.772, 80=>1.784, 120=>1.796, 160=>1.809, 200=>1.821,],
                '1'=>[40=>2.548, 80=>2.561, 120=>2.573, 160=>2.586, 200=>2.598,],
            ]
        ],
    ];
    $yingchi=[
        1 =>[
            5=>[
                '0.4'=>[40=>1.096, 80=>1.100, 120=>1.104, 160=>1.108, 200=>1.112,],
                '0.6'=>[40=>1.148, 80=>1.152, 120=>1.156, 160=>1.160, 200=>1.164,],
                '0.8'=>[40=>1.220, 80=>1.224, 120=>1.228, 160=>1.232, 200=>1.236,],
                '1'=>[40=>1.314, 80=>1.318, 120=>1.322, 160=>1.326, 200=>1.330,]
            ],
            6=>[
                '0.4'=>[40=>1.098, 80=>1.104, 120=>1.111, 160=>1.117, 200=>1.124,],
                '0.6'=>[40=>1.150, 80=>1.156, 120=>1.163, 160=>1.169, 200=>1.176,],
                '0.8'=>[40=>1.223, 80=>1.229, 120=>1.236, 160=>1.242, 200=>1.248,],
                '1'=>[40=>1.316, 80=>1.323, 120=>1.329, 160=>1.336, 200=>1.348,]
            ]

        ],
        2 =>[
            5=>[
                '0.4'=>[40=>1.100, 80=>1.104, 120=>1.108, 160=>1.112, 200=>1.116,],
                '0.6'=>[40=>1.168, 80=>1.172, 120=>1.176, 160=>1.180, 200=>1.184,],
                '0.8'=>[40=>1.284, 80=>1.288, 120=>1.292, 160=>1.296, 200=>1.300,],
                '1'=>[40=>1.491, 80=>1.496, 120=>1.500, 160=>1.505, 200=>1.510,]
            ],
            6=>[
                '0.4'=>[40=>1.102, 80=>1.108, 120=>1.115, 160=>1.121, 200=>1.128,],
                '0.6'=>[40=>1.170, 80=>1.171, 120=>1.183, 160=>1.189, 200=>1.196,],
                '0.8'=>[40=>1.287, 80=>1.293, 120=>1.299, 160=>1.306, 200=>1.312,],
                '1'=>[40=>1.504, 80=>1.511, 120=>1.519, 160=>1.526, 200=>1.534,]
            ]
        ],
        3 =>[
            5=>[
                '0.4'=>[40=>1.140, 80=>1.144, 120=>1.148, 160=>1.152, 200=>1.156,],
                '0.6'=>[40=>1.373, 80=>1.377, 120=>1.381, 160=>1.385, 200=>1.389,],
                '0.8'=>[40=>1.934, 80=>1.938, 120=>1.942, 160=>1.946, 200=>1.950,],
                '1'=>[40=>3.056, 80=>3.060, 120=>3.064, 160=>3.068, 200=>3.072,]
            ],
            6=>[
                '0.4'=>[40=>1.143, 80=>1.149, 120=>1.155, 160=>1.162, 200=>1.168,],
                '0.6'=>[40=>1.376, 80=>1.382, 120=>1.389, 160=>1.395, 200=>1.401,],
                '0.8'=>[40=>1.936, 80=>1.943, 120=>1.949, 160=>1.956, 200=>1.962,],
                '1'=>[40=>3.058, 80=>3.065, 120=>3.071, 160=>3.078, 200=>3.084,]
            ]
        ],
    ];
    if($ryc == 0){
        if($it<5){
            $it = 5;
        }elseif($it>8){
            $it = 8;
        }
        return $ruanchi[$buzhi][$it][$fd][$b];
    }else{
        if($it <=6){
            $it = 5;
        }else{
            $it = 6;
        }
        return $yingchi[$buzhi][$it][$fd][$b];
    }

}
$khb = KHBT($arr['fd'],$arr['b'],$ryc,$buzhi,$it);


function K($qd,$it,$ryc){
    if($qd >= 100){
        if($ryc == 1) {
            switch ($it) {

                case 5 or 6:
                    $k = array("kha"=>1,"kfa"=>1);
                    break;
                case 7:
                    $k = array("kha"=>1.1,"kfa"=>1.1);
                    break;
                case 8:
                    $k = array("kha"=>1.2,"kfa"=>1.2);
                    break;
            }
            return $k;
        }else{
            if($it !=8){
                $k = array("kha"=>1,"kfa"=>1);
                return $k;
            }else{
                $k = array("kha"=>1.1,"kfa"=>1.1);
                return $k;
            }
        }
    }else{
        $k = array("kha"=>1.2,"kfa"=>1.2);
        return $k;
    }
}

$k = K($qd,$it,$ryc);
$kha = $k['kha'];
$kfa = $k['kfa'];
$v =$arr['v'];


function c8 ($v) {
    if ( $v < 5 ) {
        $kv = 0.04*$v+1;
    } else {
        $kv = 0.013*$v+1;
    }
    return $kv;
}
function c7 ($v) {
    if ( $v<5){
        $kv = 0.028*$v+1;
    }else{
        $kv = 0.008*$v+1;
    }
    return $kv;
}
function c6($v){
    if($v<5){
        $kv = 0.016*$v+1;
    }else{
        $kv = 0.0044*$v+1;
    }
    return $kv;
}
if($it<6){
    $kv = c6($v);
}elseif($it == 7){
    $kv = c7($v);
}else{
    $kv = c8($v);
}
$ka = $arr['ka'];

$kh = $ka*$kv*$kha*$khb;

$d1 = $arr['d1t']*pow($kh/$arr['kht'],1/3);

$m = round($d1/$arr['z1'],3);
if($m > 50){
    $m =50;
}
$kft = 1.3;
$ea = $arr['ea'];

$ye = 0.25+(0.75/$ea);

function YFA($z){
    $yfa=[
        '17'=>['yfa'=>2.97,'ysa'=>1.52],
        '18'=>['yfa'=>2.91,'ysa'=>1.53],
        '19'=>['yfa'=>2.85,'ysa'=>1.54],
        '20'=>['yfa'=>2.80,'ysa'=>1.55],
        '21'=>['yfa'=>2.76,'ysa'=>1.56],
        '22'=>['yfa'=>2.72,'ysa'=>1.57],
        '23'=>['yfa'=>2.69,'ysa'=>1.575],
        '24'=>['yfa'=>2.65,'ysa'=>1.58],
        '25'=>['yfa'=>2.62,'ysa'=>1.59],
        '26'=>['yfa'=>2.60,'ysa'=>1.595],
        '27'=>['yfa'=>2.57,'ysa'=>1.60],
        '28'=>['yfa'=>2.55,'ysa'=>1.61],
        '29'=>['yfa'=>2.53,'ysa'=>1.62],
        '30'=>['yfa'=>2.52,'ysa'=>1.625],
        '31'=>['yfa'=>2.505,'ysa'=>1.63],
        '32'=>['yfa'=>2.495,'ysa'=>1.635],
        '33'=>['yfa'=>2.48,'ysa'=>1.64],
        '34'=>['yfa'=>2.465,'ysa'=>1.645],
        '35'=>['yfa'=>2.45,'ysa'=>1.65],
        '40'=>['yfa'=>2.40,'ysa'=>1.67],
        '45'=>['yfa'=>2.35,'ysa'=>1.68],
        '50'=>['yfa'=>2.32,'ysa'=>1.70],
        '60'=>['yfa'=>2.28,'ysa'=>1.73],
        '70'=>['yfa'=>2.24,'ysa'=>1.75],
        '80'=>['yfa'=>2.22,'ysa'=>1.77],
        '90'=>['yfa'=>2.20,'ysa'=>1.78],
        '100'=>['yfa'=>2.18,'ysa'=>1.79],
        '150'=>['yfa'=>2.14,'ysa'=>1.83],
        '200'=>['yfa'=>2.14,'ysa'=>1.865],
    ];
    if($z>35 && $z<40){
        return ['yfa'=>2.43,'ysa'=>1.66];
    } elseif ($z<45) {
        return ['yfa' => 2.37, 'ysa' => 1.675];
    } elseif ($z<50){
        return ['yfa'=>2.335,'ysa'=>1.69];
    } elseif ($z<60){
        return ['yfa'=>2.30,'ysa'=>1.715];
    } elseif ($z<70){
        return ['yfa'=>2.26,'ysa'=>1.74];
    } elseif ($z<80){
        return ['yfa'=>2.23,'ysa'=>1.76];
    } elseif ($z<90){
        return ['yfa'=>2.21,'ysa'=>1.775];
    } elseif ($z<100){
        return ['yfa'=>2.19,'ysa'=>1.67];
    } elseif ($z<150){
        return ['yfa'=>2.16,'ysa'=>1.81];
    }elseif ($z<200){
        return ['yfa'=>2.14,'ysa'=>1.845];
    }elseif($z>200){
        return ['yfa'=>2.06,'ysa'=>1.97];
    }else{
        return $yfa[$z];
    }
}

$y1 = YFA($arr['z1']);
$y2 = YFA($arr['z2']);
$yfa1 = $y1['yfa'];
$ysa1 = $y1['ysa'];
$yfa2 = $y2['yfa'];
$ysa2 = $y2['ysa'];

function FLIM($cl,$hbs){
    if($cl['a']<=2){
        return 0.6*$hbs+3;
    }elseif($cl['a']<=4){
        return 1.2*$hbs-22;
    }elseif ($cl['a'] == 7) {
        return 0.9*$hbs+91;
    }elseif ($cl['a'] == 8) {
        return 0.12*$hbs+330;
    }elseif ($cl['a'] <= 11){
        return 0.72*$hbs+56;
    }else{
        return 700;
    }
}
$cl1 = $arr['cl1'];
$cl2 = $arr['cl2'];
$hbs1 = $arr['zdl_hbs'];
$hbs2 = $arr['cdl_hbs'];
$flim1 = FLIM($cl1,$hbs1);
$flim2 = FLIM($cl2,$hbs2);

function Kfn1 ( $n ) {
    if ( $n > 100 && $n < 10000 ) {
        return 2.5;
    } else if ( $n >= 10000 && $n<3000000){

       return  2.5*pow($n/10000,-0.1606462);
    } else if ( $n >= 3000000 ) {
        return  1;
    }
}


function Kfn2($n)
{
    if ($n > 100 && $n < 1000) {
        return 2.5;
    } elseif ($n >= 1000 && $n < 3000000) {

        return 2.5*pow($n/1000,-0.1144452);

    } elseif ($n >= 3000000) {
        return 1;
    }

}

function Kfn3($n){
    if ( $n>100 && $n<1000){
        return 1.6;
    } elseif ($n>=1000 && $n<3000000){

        return 1.6*pow($n/1000,-5.870373E-02);
    } elseif ( $n >= 3000000 ) {
        return 1;
    }
}

function Kfn4 ( $n) {
    if ( $n > 100 && $n < 1000) {
        return 1.1;
    } elseif ( $n >= 1000 && $n < 3000000 ) {
        return 1.1*pow($n/1000,-0.0119043);
    } elseif ( $n >= 3000000 ) {
        return 1;
    }
}

function Kfn ( $cl, $n ) {
    if ( $cl['a'] <= 4 ) {
        return Kfn3($n);
    } elseif ( $cl['a'] <= 8) {
        return Kfn1($n);
    } elseif ($cl['a']>=23){
        return Kfn4( $n) ;
    } else {
        return Kfn2( $n );
    }
}
$kfn1 =Kfn($cl1,$arr['n']);

$kfn2 =Kfn($cl2,$arr['n2']);
$sa = $arr['sa'];
$alow_f1 = round(($kfn1*$flim1)/$sa);
$alow_f2 = round(($kfn2*$flim2)/$sa);
$a1 = ($yfa1*$ysa1)/$alow_f1;
$a2 = ($yfa2*$ysa2)/$alow_f2;
$a = $a1>$a2?$a1:$a2;

$fd = $arr['fd'];
$z1 = $arr['z1'];

$mt3 = ((2*$kft*$arr['t1']*$ye)/($fd*$z1*$z1))*$a;

$mt = pow($mt3,1/3);

$_d1 = $mt*$z1;
$_v = (M_PI*$_d1*$arr['n1'])/60000;
$_b = $fd*$_d1;
$_h = 2.25*$mt;
$i = round($_b/$_h,2);

if($it<6){
    $_kv = c6($_v);
}elseif($it==7){
    $_kv = c7($_v);
}else{
    $_kv = c8($_v);
}
$_ft1 = (2*$arr['t1'])/$_d1;
$_khb = KHBT($fd,$_b,$ryc,$arr['gear'],$it);

if($i>12){
   $kfb = $_khb;
} else if ( $i > 6 ) {
    $max_kfb = floor( ( 1.033 * pow( $i/1.03, 1.10087 ) ) * 1000);
    $min_kfb = floor(( 1.036 * pow( $i/1.03, 1.230439 ) ) * 1000);
} else if ( $i > 4 ) {
    $max_kfb = floor(( 1.036 * pow($i/1.03,1.230439))*1000);
    if($_khb<1.6){
        $min_kfb = floor(( 1.42*pow($i/1.03,0.661143))*1000);
    }else{
        $min_kfb = floor(( 1.9*pow($i/1.6,1.418008))*1000);
    }
} else if ( $i > 3 ) {
    if($_khb<1.6){
        $max_kfb = floor (( 1.42 * pow( $i/1.03, 0.661143) ) * 1000);
        //    n1(1)= 1.47 X (pd/ 1.03)^ .6990314
        $min_kfb = floor(( 1.47 * pow( $i/1.03, 0.6990314))*1000);
    }else{
        $max_kfb = floor(( 1.42 * pow( $i/1.03, 0.661143))*1000);
        $min_kfb = floor(( 1.9 * pow( $i/1.6, 1.658963))*1000);
    }
} else {
    die('齿宽过小请重新设计');
}
$kfb = rand($min_kfb,$max_kfb)/1000;

$kf = $arr['ka']*$_kv*$kfa*$kfb;


$m = ceil($mt*pow($kf/$kft,1/3));

$_z1 = ceil($d1/$m);
$_z2 = ceil(($d1/$m)*$u);
$final_d1 = $_z1*$m;
$final_d2 = $_z2*$m;
$_a = ($final_d1+$final_d2)/2;
$_b = $fd*$final_d1;
$final_b1 = $_b+6;
$final_b2 = $_b;


$file_name = date('Y年m月d日H时i分s秒').'.xlsx';

$time = date('Y年m月d日 H时i分s秒');
$n2 = floor($arr['n1']/$u);
$da1 = $final_d1+(2*2.25*$m);
$da2 = $final_d2+(2*2.25*$m);
$df1 = $final_d1-(2.5*$m);
$df2 = $final_d2-(2.5*$m);
$hf = 1.25*$m;
$h = $hf+$m;
include_once './Classes/PHPExcel.php';

$objPHPExcel = new PHPExcel();
$dir = dirname(__FILE__);
$objSheet = $objPHPExcel->getActiveSheet();
$objSheet->setTitle('helen');
$data = [
    ["设计时间", "$time", "", "", "", "", "", ""],
    ["主要原始数据", "", "", "", "设计数据", "", "从动轮齿数", "$_z2"],
    ["", "", "",                      "主动轮齿数", "$_z1", "", "齿间载荷分配系数（接触）KHα", "$kha"],
    ["名义功率（KW", "$arr[kw]", "",              "模数", "$m", "", "齿间载荷分配系数（弯曲）KFα","$kfa"],
    ["初选传动比i", "$arr[u]", "",                "实际传动比i", "$u", "", "实际载荷系数K", " $kf"],
    ["主动轮转速（转速/分）n2", "$arr[n1]", "",          "中心距a", "$_a", "", "端面重合度εα", "$arr[ea]"],
    ["名义转矩T1", "$arr[t1]", "",                "主动轮分度圆直径d1", "$final_d1", "", "重合度系数（接触）Zε", "$arr[ze1]"],
    ["工作年数", "$arr[year]", "",                "主动轮齿顶圆直径da1", "$da1", "", "重合度系数（弯曲）", "$ye"],
    ["每年工作天数", "$arr[day]", "",              "主动轮齿根圆直径df1", "$df1", "", "区域系数", "2.5"],
    ["每天工作时数", "$arr[hour]", "",             "从动轮分度圆直径d2", "$final_d2", "", "弹性系数", "$arr[ze]"],
    ["是否开式传动", "$arr[k]", "",                "从动轮齿顶圆直径da2", "$da2", "", "主动轮的齿形系数", "$yfa1"],
    ["是否双向旋转", "$arr[j]", "",                "从动轮齿根圆直径df2", "$df2", "", "主动轮的应力修正系数", "$yfa2"],
    ["原动机情况", "$arr[ydj]", "",                "主动轮齿宽b1", "$final_b1", "", "从动轮的齿形系数", "$yfa2"],
    ["工作机情况", "$arr[gzj]", "",                "从动轮齿宽b2", "$final_b2", "", "从动轮的应力修正系数", "$ysa2"],
    ["主动轮材料牌号及加工方式", "$arr[zdl_cl]", "", "齿顶高ha", "$m", "", "主动轮材料的接触疲劳极限", "$arr[alow_h1]"],
    ["从动轮材料牌号及加工方式", "$arr[cdl_cl]", "", "齿根高hf", "$hf", "", "主动轮材料的弯曲疲劳极限", "$flim1"],
    ["主动轮材料硬度", "$arr[zdl_hbs]", "",        "齿全高h", "$h", "", "从动轮材料的接触疲劳极限", "$arr[alow_h2]"],
    ["从动轮材料硬度", "$arr[cdl_hbs]", "",        "工况系数kA", "$arr[ka]","", "从动轮材料的弯曲疲劳极限", "$flim2"],
    ["主动轮齿数Z1", "$arr[z1]", "",              "动荷系数Kv", "$_kv", "", "主动轮的接触寿命系数", "$arr[khn1]"],
    ["接触安全系数SH", "$arr[s]", "",              "主动轮的许用弯曲应力", "$alow_f1", "", "主动轮的弯曲寿命系数", "$kfn1"],
    ["弯曲安全系数SF", "$arr[sa]", "",              "从动轮的许用弯曲应力", "$alow_f2", "", "从动轮的接触寿命系数", "$arr[khn2]"],
    ["初选载荷系数kt", "$arr[kht]", "",                 "齿向载荷分布系数kβ", "$_khb", "", "从动轮的弯曲寿命系数", "$kfn2"],
    ["齿宽系数φd", "$arr[fd]", "",               "主动轮的许用接触应力", "$arr[alow_h1]", "", "从动轮的许用接触应力", "$arr[alow_h2]"],

];
$objSheet->fromArray($data);  //利用fromArray()直接一次性填充数据
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');//设定写入excel的类型
$objPHPExcel->getActiveSheet()->getstyle("A1:J28")->getAlignment()
    ->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);

$objPHPExcel->getActiveSheet()->getStyle("A2")->getFont()->setBold(true)
    ->setName('Verdana')
    ->setSize(15)
    ->getColor()->setRGB('#fcaf17');
$objPHPExcel->getActiveSheet()->getStyle("C2")->getFont()->setBold(true)
    ->setName('Verdana')
    ->setSize(15)
    ->getColor()->setRGB('#fcaf17');
$objPHPExcel->getActiveSheet()->getStyle("E2")->getFont()->setBold(true)
    ->setName('Verdana')
    ->setSize(15)
    ->getColor()->setRGB('#fcaf17');
$objWriter->save($file_name);   //保存文件

?>
<!DOCTYPE html>

<html lang="en">
<head>
		<meta http-equiv="Content-Type"		
			content="text/html; charset=utf-8"/>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    #div1{
        margin: 0 auto;
        width: 1200px;
        height: 600px;
        background-color:  #F0F0F0;
        align-content: center;
        padding-left: 50px;
        padding-right: 50px;
        padding-top: 50px;
       
    }
    #div2{
    margin: 0 auto;
    padding-top: 10px;
    width: 300px;
    text-align: center;
}
    #table1{
        margin: 0 auto;
        width: border-box;
        border: #1a1a1a solid 1px;
        padding: 10px 10px;
    }
   #div1 input{
        width: 50px;
    }
    #div2>input{
        width: auto;
    }
</style>

<body>
<div id="div1">
<table id="table1">
    <tr>
        <td>实际传动比i</td>
        <td><input type="text" value="<?=$u  ?>" readonly></td>
        <td>齿间载荷分配系数khα</td>
        <td><input type="text" value="<?=$kha ?>" readonly></td>
        <td colspan="2">主动轮:</td>
        <td colspan="2">从动轮:</td>

    </tr>
    <tr>
        <td>模数mn</td>
        <td><input type="text" value="<?=$m ?>" readonly></td>
        <td>齿间载荷分配系数KFα（弯曲）</td>
        <td><input type="text" value="<?=$kfa ?>" readonly></td>
        <td>齿数Z1</td>
        <td><input type="text" value="<?=$_z1 ?>" readonly></td>
        <td>齿数Z2</td>
        <td><input type="text" value="<?=$_z2 ?>" readonly></td>
    </tr>
    <tr>
        <td rowspan="2">齿宽系数Φd</td>
        <td rowspan="2"><input type="text" value="<?=$arr['fd'] ?>" readonly></td>
        <td>载荷系数KH(接触)</td>
        <td><input type="text" value="<?=round($kh,2)  ?>" readonly></td>
        <td>分度圆直径d1</td>
        <td><input type="text" value="<?=$final_d1 ?>" readonly></td>
        <td>分度圆直径d2</td>
        <td><input type="text" value="<?=$final_d2 ?>" readonly></td>
    </tr>
    <tr>

        <td>载荷系数KF(弯曲)</td>
        <td><input type="text" value="<?=round($kf,2)  ?>" readonly></td>
        <td>齿宽b1</td>
        <td><input type="text" value="<?=$final_b1 ?>" readonly></td>
        <td>齿宽b2</td>
        <td><input type="text" value="<?=$final_b2  ?>" readonly></td>
    </tr>
    <tr>
        <td>中心距a</td>
        <td><input type="text" value="<?=$_a ?>" readonly></td>
        <td>区域系数ZH</td>
        <td><input type="text" value="2.5" readonly></td>
        <td>接触疲劳极限σHim1</td>
        <td><input type="text" value="<?=$arr['alow_h1'] ?>" readonly></td>
        <td>接触疲劳极限σHim2</td>
        <td><input type="text" value="<?=$arr['alow_h2'] ?>" readonly></td>
    </tr>
    <tr>
        <td>工况系数KA</td>
        <td><input type="text" value="<?=$ka ?>" readonly></td>
        <td>接触重合度及螺旋角系数Zεβ</td>
        <td><input type="text" value="<?=round($ye,2) ?>" readonly></td>
        <td>接触寿命系数ZN1</td>
        <td><input type="text" value="<?=$arr['khn1'] ?>" readonly></td>
        <td>接触寿命系数ZN2</td>
        <td><input type="text" value="<?=$arr['khn2'] ?>" readonly></td>
    </tr>
    <tr>
        <td>动荷系数KV</td>
        <td><input type="text" value="<?=round($_kv,2)  ?>" readonly></td>
        <td></td>
        <td></td>
        <td>接触许用应力[σ]H1</td>
        <td><input type="text" value="<?=$arr['alow_h1'] ?>" readonly></td>
        <td>接触许用应力[σ]H2</td>
        <td><input type="text" value="<?=$arr['alow_h2'] ?>" readonly></td>
    </tr>
    <tr>
        <td>齿向载荷分布系数Kβ</td>
        <td><input type="text" value="<?=$_khb ?>" readonly></td>
        <td>接触重合度及螺旋角系数</td>
        <td><input type="text" value="<?=$arr['ze1'] ?>" readonly></td>
        <td>弯曲疲劳极限σFlim1</td>
        <td><input type="text" value="<?=$flim1 ?>" readonly></td>
        <td>弯曲疲劳极限σFlim2</td>
        <td><input type="text" value="<?=$flim2  ?>" readonly></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td>弯曲重合度及螺旋角系数</td>
        <td><input type="text" value="<?=$ye ?>" readonly></td>
        <td>弯曲寿命系数YN1</td>
        <td><input type="text" value="<?=$kfn1  ?>" readonly></td>
        <td>弯曲寿命系数YN2</td>
        <td><input type="text" value="<?=$kfn2 ?>" readonly></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>弯曲许用应力[σ]F1</td>
        <td><input type="text" value="<?=$alow_f1 ?>" readonly></td>
        <td>弯曲许用应力[σ]F2</td>
        <td><input type="text" value="<?=$alow_f2 ?>" readonly></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>齿形系数YFa1</td>
        <td><input type="text" value="<?=$yfa1 ?>" readonly></td>
        <td>齿形系数YFa2</td>
        <td><input type="text" value="<?=$yfa2 ?>" readonly></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td>应力集中系数YSa1</td>
        <td><input type="text" value="<?=$ysa1 ?>" readonly></td>
        <td>应力集中系数YSa2</td>
        <td><input type="text" value="<?=$ysa2 ?>" readonly></td>
    </tr>
</table>
<div id="div2">
    <a href="./<?php echo $file_name?>"><input type="button" value="下载数据" style="width: 80px;"></a>

<a href="index.php"><input type="button" value="再次计算"  style="width: 80px"></a>

</div>
</div>
</body>
</html>
